{{ define "main" }}
<div ref="streamContainer" class="stream-container">
    <div class="post-list-container post-list-container-shadow">
        <div class="post">
            {{ $post_class := "post-head-wrapper-text-only"}}
            {{ $featured_image := .Params.featured_image }}
            {{ if $featured_image }}
                {{ $post_class = "post-head-wrapper"}}
            {{ end }}

            <div class="{{$post_class}}"
                {{ if $featured_image }}
                    {{ $image := .Resources.GetMatch (.Params.featured_image) }}
                    {{ if $image }}
                    style="background-image: url('{{$image.Permalink }}')"
                    {{ else }}
                    style="background-image: url('{{ $featured_image | absURL}}')"
                    {{ end }}
                {{ end }}
            >
                <div class="post-title">
                    {{ .Title }}
                    {{ if .Params.description }}
                    <div class="post-subtitle">
                        {{ .Params.description }}
                    </div>
                    {{ end }}
                    <div class="post-meta">
                        {{ if .Params.date}}
                        <time itemprop="datePublished">
                            {{ i18n "format_date_tosec" .PublishDate }}
                        </time>
                        {{ end }}

                        {{ if .Params.categories }}
                            <i class="material-icons" style="">folder</i>
                                <a href="{{ "/categories/" | relLangURL }}{{ .Params.categories | urlize }}">{{ .Params.categories }}</a>
                                &nbsp;
                        {{ end }}

                        {{ if gt .Params.tags 0 }}
                            <i class="material-icons" style="">label</i>
                            {{ range .Params.tags }}
                                <a href="{{ "/tags/" | relLangURL }}{{ . | urlize }}">{{ . }}</a>
                                &nbsp;
                            {{ end }}
                        {{ end }}
                        {{ if .Site.Params.enableReadingTime }}
                            <i class="material-icons" style="">schedule</i>
                            {{ $readTime := mul (div (countwords .Content) 220.0) 60 }}

                            {{ $minutes := math.Floor (div $readTime 60) }}
                            {{ $seconds := mod $readTime 60 }}

                            {{ if gt $minutes 0}}
                            {{ $minutes }} {{ cond (eq $minutes 1) "minute" "min" }}
                            {{ end }}
                            {{ $seconds }} {{ cond (eq $seconds 1) "second" "s" }}.
                        {{ end }}
                    </div>
                </div>
            </div>
            
            <div class="post-body-wrapper">
                {{ if .Params.enableVue }}
                <div class="post-body">
                {{ else }}
                <div class="post-body" v-pre>
                {{ end }}
                    {{.Content}}
                    {{ if not .Lastmod.IsZero }}
                    <HR width="100%" id="EOF">
		    <p style="color:#777;">{{ i18n "last_mod_on" .Page.Lastmod }}</p>
                    {{ end }}
                </div>
            </div>
            
            
            <nav class="post-pagination">

                {{if .Next}}
                <a class="newer-posts" href="{{.Next.Permalink}}">
			{{ i18n "next_link" }}<br>{{.Next.Title}}
                </a>
                {{else}}
                <a class="newer-posts">
			{{ i18n "next_link" }}<br>{{ i18n "no_newer_posts"}}
                </a>
                {{end}}
                
                {{if .Prev}}
                <a class="older-posts" href="{{.Prev.Permalink}}">
			{{ i18n "prev_link" }}<br>{{.Prev.Title}}
                </a>
                {{else}}
                <a class="older-posts">
			{{ i18n "prev_link" }}<br>{{ i18n "no_older_posts" }}
                </a>
                {{end}}
            </nav>
            <div class="post-comment-wrapper">
                {{ if eq .Params.comment false }}
                <p style="opacity: 0.6" align="center">
                    <small>{{ i18n "comments_disabled" }}</small>
                </p>
                {{ else }}
                {{- partial "comment.html" . -}}
                {{ end }}
            </div>
        </div>
    </div>
</div>
{{ end }}
